package cn.itsource.ymcc.exception;

import cn.itsource.ymcc.errorcode.ErrorCode;
import lombok.Data;

//全局异常
@Data
public class GlobalException extends RuntimeException{

    private ErrorCode errorCode;

    private String message;
    /**--------------------------------------------------------
     传一个错误信息给异常对象
     --------------------------------------------------------**/

    public GlobalException(){}
    public GlobalException(String message){
        this.message = message;
    }
    public GlobalException(ErrorCode errorCode){
        this.errorCode = errorCode;
    }
    public ErrorCode getErrorCode() {
        return errorCode;
    }

    @Override
    public String getMessage() {
        return message;
    }

}